package br.com.lambdacore.validator;

import java.util.Collection;
import java.util.Map;

import br.com.lambdacore.validator.impl.ArrayValidator;
import br.com.lambdacore.validator.impl.ClassValidator;
import br.com.lambdacore.validator.impl.CollectionValidator;
import br.com.lambdacore.validator.impl.MapValidator;
import br.com.lambdacore.validator.impl.NumberValidator;
import br.com.lambdacore.validator.impl.StringValidator;

public class Validator<T> {

	private T object;

	protected Validator(T object) {
		this.setObject(object);
	}

	public boolean equalThan(T object) {
		return object.equals(this.getObject());
	}

	public boolean nil() {
		return this.getObject() == null;
	}

	public boolean notEqualThan(T object) {
		return !this.equalThan(object);
	}

	public boolean notNil() {
		return !this.nil();
	}

	protected T getObject() {
		return this.object;
	}

	private void setObject(T object) {
		this.object = object;
	}

	public static ClassValidator is(Class<?> object) {
		return ClassValidator.is(object);
	}

	public static CollectionValidator is(Collection<?> collection) {
		return CollectionValidator.is(collection);
	}

	public static MapValidator is(Map<?, ?> map) {
		return MapValidator.is(map);
	}

	public static NumberValidator is(Number number) {
		return NumberValidator.is(number);
	}

	public static ArrayValidator is(Object[] objects) {
		return ArrayValidator.is(objects);
	}

	public static StringValidator is(String string) {
		return StringValidator.is(string);
	}

	public static <T> Validator<T> is(T object) {
		return Validator.is(object);
	}

}
